package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.OpenPlatformEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

public class UserAttentionInfoRequest extends Request {

	private Integer id;
	
	private Integer followUserId;
	
	private Integer followedUserId;
	
	private Integer openPlatformId;
	
	public UserAttentionInfoRequest() {
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		this.followUserId = requestInfo.getIntParameter(ApiUrlParamEnum.followUserId.getParamName(), 0);
		this.followedUserId = requestInfo.getIntParameter(ApiUrlParamEnum.followedUserId.getParamName(), 0);
		this.openPlatformId = requestInfo.getIntParameter(ApiUrlParamEnum.openPlatformId.getParamName(), OpenPlatformEnum.WECHAT_HDC.getId());
		this.id = requestInfo.getIntParameter(ApiUrlParamEnum.id.getParamName(), 0);
		if (id < 1) {
			if (followedUserId < 1) {
				throw new RequestIllegalException("error followedUserId: " + followedUserId);
			}
		}
		if (followUserId < 1) {
			throw new RequestIllegalException("error followUserId: " + followUserId);
		}
		
	}

	public Integer getFollowUserId() {
		return followUserId;
	}

	public void setFollowUserId(Integer followUserId) {
		this.followUserId = followUserId;
	}

	public Integer getFollowedUserId() {
		return followedUserId;
	}

	public void setFollowedUserId(Integer followedUserId) {
		this.followedUserId = followedUserId;
	}

	public Integer getOpenPlatformId() {
		return openPlatformId;
	}

	public void setOpenPlatformId(Integer openPlatformId) {
		this.openPlatformId = openPlatformId;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

}
